<?php
if ($status_modify == "Y") {
    $result = $r->return_result_by_object($TABLE, "where uid ='$bbs_uid'", $field = "*");

    $WRITE_MOD_SELECT = $PAGE_MOD_OK;
} else {
    $WRITE_MOD_SELECT = $PAGE_WRITE_OK;
}
?>
<table id="write_comment" width="100%" border="0" cellpang="0" cellspacing="0">
    <tr>
        <td  class="left" colspan="2"  bgcolor="#E5E5E5"> 작성자
            <input type="text" id="comment_name" name="comment_name" value="<?= $result->user_nick; ?>"  onmouseover="bbs.getFocus(this);">
            비밀번호 <input  type="password" id="comment_pass"  name="comment_pass">
        </td>
    </tr>
    <tr>
        <td class="left">
            <textarea  id="comment_content" class=" h_100"   name="comment_content" cols="0" rows="6" style="width:98%; vertical-align: top;" ><?= $result->comment_text; ?></textarea>
        </td>
        <td class="left w_100" id="comment_button_area">
            <input type="button" id="comment_submit_button" class="w_100 h_50" value="등록" style=" vertical-align: top; "  onClick="writeCommentCheck();
                    return false;">
            <input type="hidden" id="reply_num" value="">
            <input type="hidden" id="reply_uid" value="">
        </td>
    </tr>
</table>


<script  language='JavaScript' charset='utf-8'>
    function joinCommentCheck() {
        if ($("#comment_name").val() < 2) {
            alert("이름은 최소 2자이상 입력해야 합니다.");
            $("#comment_name").focus();
            return false;
        }

        if ($("#comment_content").val() < 1) {
            alert("내용이 없습니다.");
            // $("#content").focus(); 안먹힘
            return false;
        }
        return true;
    }
//일반글 전송
    function writeCommentCheck() {
        //아무이상 없으면 글쓰기실행
        if (joinCommentCheck()) {

            bbs.swapPage("<?= $WRITE_MOD_SELECT; ?>", "<?= $layer_id; ?>", function () {
                bbs.swapPage("<?= $PAGE_LIST; ?>", "<?= $layer_id; ?>");
            }, "html", '', $("#comment_name").val(), $("#comment_pass").val(), $("#comment_content").val(), "<?= $_F->makeToken($SESSION_WRITE); ?>", $("#reply_num").val(), $("#reply_uid").val());
        }
    }

</script>









